<?php
namespace app\admin\module;

use app\common\model\Article;

class ArticleModule{

    public static function page($pageSize = 10){
        return Article::where([])->with('cate')->order('id','desc')->paginate($pageSize);
    }

    public static function create($data){
        $data['createtime'] = time();
        Article::create($data);
    }

    public static function update($data){
        $data['updatetime'] = time();
        Article::update($data,['id'=>$data['id']]);
    }

    public static function del($id){
        Article::destroy($id);
    }

}
